home *** CD-ROM | disk | FTP | other *** search
/ Internet Tools (InfoMagic) / Internet Tools.iso / dos_win / winsock / hacklist / 94-04.Z / 94-04 / 000004_paul@atlas.dev.abccomp.oz.au_Wed Apr 6 05:37:08 1994.msg < prev    next >
Internet Message Format  |  1994-04-30  |  4KB

  1. Received: from usage.csd.unsw.OZ.AU by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.07) with SMTP
  2.           id AA26406; Tue, 5 Apr 1994 20:24:57 -0400
  3. Received: by usage.csd.unsw.OZ.AU id AA22673
  4.   (5.65c/IDA-1.4.4 for winsock-hackers%sunsite.unc.edu); Wed, 6 Apr 1994 10:24:07 +1000
  5. Received: by atlas (4.1/1.35)
  6.     id AA11109; Wed, 6 Apr 94 10:37:09 EST
  7. Message-Id: <9404060037.AA11109@atlas>
  8. From: paul@atlas.abccomp.oz.au
  9. Date: Wed, 6 Apr 1994 10:37:08 -0500
  10. X-Mailer: Mail User's Shell (7.2.2 4/12/91)
  11. To: bryan@alex.com,
  12.         Multiple recipients of list <winsock-hackers@sunsite.unc.edu>
  13. Subject: Re: Closing and reusing sockets
  14.  
  15. Thus expounded Bryan Boreham on Apr 5, 9:26am:
  16. /--------------------
  17. |> From: paul@atlas.abccomp.oz.au
  18. |
  19. |> To avoid WSAEADDRINUSE errors, you must make sure a socket is fully closed
  20. |> before you can connect _from_the_same_port_number_ to the same remote
  21. |> machine listening on the _same_remote_port_ - possibly by blocking in 
  22. |> a lingering close, or using linger to hard-close the connection when
  23. |> you're done the first time.
  24. |
  25. |This is roughly what I said in the very first message in this thread -- 
  26. |hard-closing
  27. |the socket makes the problem go away.  I guess that waiting for the close to
  28. |complete (probably not actually blocking, given that we're all nice cooperative
  29. |Windows programmers) is gentler, but it would complicate the exit logic of the
  30. |program rather a lot.
  31. |
  32. |This would all be a lot easier if we could rely on bind() giving EADDRINUSE 
  33. |so that the next port could be used instead, and leave the stack to
  34. |get on with closing down the old one quietly.
  35.  
  36. True, but you still have to think about the case where your local machine
  37. has closed the socket down OK, allowing you to BIND to the same
  38. port number in the future, but the REMOTE end still has the same
  39. port/address association valid, probably in TIMEWAIT state for two minutes.
  40.  
  41. In this case, your bind() will succeed, but the remote end may well refuse
  42. the connection. WSAEADDRINUSE is a valid return from connect(),
  43. as well as bind(). Also, if you set the socket option SO_REUSEADDR you will
  44. be allowed to bind() to the same port number, on the assumption that you want
  45. to connect to a different host/port from last time. If you try to connect()
  46. to the same host/port as last time, you'll get back WSAEADDRINUSE from
  47. connect().
  48.  
  49. Maybe if you describe what you are actually trying to do to the list,
  50. instead of vague references to a private exchange, we might be able
  51. to help you.
  52.  
  53.  
  54. -- 
  55. Paul Brooks              |paul@abccomp.oz.au       |Emerging Standard:
  56. TurboSoft Pty Ltd        |pwb@newt.phys.unsw.edu.au|  one that has not yet
  57. 579 Harris St., Ultimo   |                         |  been superseded.
  58. Sydney Australia 2007    |ph: +61 2 281 3155       |  
  59. From stcheng@ee.tamu.edu Tue Apr  5 16:33:01 1994
  60. Received: from EE.TAMU.EDU by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.07) with SMTP
  61.           id AA11603; Tue, 5 Apr 1994 22:31:34 -0400
  62. Received: by ee.tamu.edu (5.61/1.34)
  63.     id AA13007; Tue, 5 Apr 94 21:33:02 -0500
  64. From: stcheng@ee.tamu.edu (Franklin S. Cheng)
  65. Message-Id: <9404060233.AA13007@ee.tamu.edu>
  66. Subject: setoptsock()
  67. To: winsock-hackers@sunsite.unc.edu (WINSOCK)
  68. Date: Tue, 5 Apr 1994 21:33:01 -0500 (CDT)
  69. X-Mailer: ELM [version 2.4 PL21]
  70. Content-Type: text
  71. Content-Length: 765       
  72.  
  73.  
  74. Fellow hackers,
  75.  
  76. setoptsock() allows socket programmers to modify the socket
  77. options, like the buffer size for sending and receiving.(using 
  78. level= SOL_SOCKET and optname= SO_RCVBUF and SO_SNDBUF)
  79.  
  80. My question is when the  _receiving_  buffer size is bigger than one UDP packet,
  81. say 5 times. Will the incoming 5 packets be held in the buffer if
  82. the app doesn't read it ? Or no matter how big the buffer size is,
  83. it always holds just one UDP packet and discard the subsequence UDP
  84. packets if the apps doesn't read it ? What about if the buffer size
  85. is 5.3 times of the size of the incoming UDP packets , would the 
  86. 6th one be stuffed into the remaining buffer size -- .3 of the UDP
  87. packet ?
  88.  
  89. And how about the _sending_ buffer for this case ?
  90.  
  91. thanks,
  92.  
  93. Franklin.